<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
  <head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
    <title>
      Stepping through the execution of a Java program
    </title>
    <script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js" type="text/javascript"> </script>
  </head>
  <body>
    <h1>
      Stepping Through the Execution of a Java Program
    </h1>
    <p>
      When a thread is suspended, the step controls can be used to step through the execution of the program line-by-line.
      If a breakpoint is encountered while performing a step operation,&nbsp;
      the execution will suspend at the breakpoint and the step operation is
      ended.
    </p>
    <h2>
      Step Over
    </h2>
    <ol>
      <li>
        Select a stack frame in the <a href="../reference/views/debug/ref-debug_view.htm"><strong>Debug View</strong></a>. The current line of execution in that stack frame is highlighted in the editor in the <strong>Debug Perspective</strong>.      </li>
      <li>
        Click the <strong><a href="../reference/views/debug/ref-stepover.htm">Step Over</a></strong> button [ <img src="../images/org.eclipse.debug.ui/elcl16/stepover_co.svg" alt="Step Over"> ] in the  view toolbar, or press the <em><strong>F6</strong></em> key. The currently-selected line is executed and
        suspends on the next executable line.      </li>
    </ol>
    <h2>
      Step Into
    </h2>
    <ol>
      <li>
        Select a stack frame in the <a href="../reference/views/debug/ref-debug_view.htm"><strong>Debug View</strong></a>. The current line of execution in the selected frame is highlighted in the editor in the <strong>Debug Perspective</strong>.      </li>
      
  <li> Click the <strong><a href="../reference/views/debug/ref-stepinto.htm">Step 
    Into</a></strong> button [ <img src="../images/org.eclipse.debug.ui/elcl16/stepinto_co.svg" alt="Step Into"> 
    ] in the view toolbar, or press the <strong><em>F5</em></strong> key. The 
    next expression on the currently-selected line to be executed is invoked, 
    and execution suspends at the next executable line in the method that is invoked. 
  </li>
    </ol>
    
<h2> Step Into Selection</h2>
<ol>
  <li> Select a stack frame in the <a href="../reference/views/debug/ref-debug_view.htm"><strong>Debug View</strong></a>. The current line of execution in 
    the selected frame is highlighted in the editor in the <strong>Debug Perspective</strong>.  </li>
  <li>In the <a href="../reference/views/ref-java-editor.htm"><strong>Java Editor</strong></a>, within the current line of execution, place the cursor 
    on the name of a method that you would like to step into.</li>
  <li> Click the <strong>Step into Selection </strong>action in the Run menu or 
    Java editor context menu, or press the <em><strong>Ctrl-F5</strong></em> key. Execution resumes 
    until the selected method is invoked. </li>
</ol>
    <h2>
      Step With Filters
    </h2>
    
<ol>
  <li>Toggle the <strong><a href="../reference/views/debug/ref-usestepfilters.htm">Use Step Filters</a></strong> button [ <img src="../images/org.eclipse.debug.ui/elcl16/stepbystep_co.svg" alt="Use Step Filters"> ] in the Debug view toolbar, 
    or use <em><strong>Shift+F5</strong></em>. When the action is toggled on, each of the step 
    actions (over, into, return) will apply the set of step filters which are 
    defined in the
    <a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.debug.ui.JavaStepFilterPreferencePage)")'>
    <img src="PLUGINS_ROOT/org.eclipse.help/command_link.svg" alt="Opens the Step Filtering preference page">
    <strong>Java &gt; Debug &gt; Step Filtering</strong></a> preference page. When a step action is invoked, 
    stepping will continue until an unfiltered location is reached or a breakpoint 
    is encountered.</li>
</ol>
    <h2>
      Step Return
    </h2>
    <ol>
      <li>
        Select a stack frame in the <a href="../reference/views/debug/ref-debug_view.htm"><strong>Debug View</strong></a>. The current line of execution in the selected frame is highlighted in the editor in the <strong>Debug Perspective</strong>.      </li>
      <li>
        Click the <strong><a href="../reference/views/debug/ref-stepreturn.htm">Step Return</a></strong> button [ <img src="../images/org.eclipse.debug.ui/elcl16/stepreturn_co.svg" alt="Step Return"> ] in the  view toolbar or press the <em><strong>F7</strong></em> key. Execution resumes until the next return
        statement in the current method is executed, and execution suspends on the next executable line.      </li>
    </ol>
    <h2>
      Run to Line
    </h2>
    <p>
      When a thread is suspended, it is possible to resume execution until a specified line is executed. This is a convenient way to suspend execution at a line without setting a
      breakpoint.
    </p>
    <ol>
      <li>
        Place your cursor on the line at which you want the program to run.      </li>
      <li>
        Select the <strong>Run to Line</strong> command [ <img src="../images/org.eclipse.debug.ui/elcl16/runtoline_co.svg" alt="Run To Line"> ] from the pop-up menu or use
        <em><strong>Ctrl+R</strong></em>. Program execution is resumed and suspends just before the specified line is to be executed.      </li>
    </ol>
    <p>It is possible that the line will never be hit and that the program will not suspend.&nbsp;</p>
    <p> Breakpoints and exceptions can cause the thread to suspend before reaching the specified
        line.</p>
    <h3 class="related">Related Concepts</h3>
      <a href="../concepts/cbrkpnts.htm">Breakpoints</a><br>
      <a href="../concepts/concept-java-perspective.htm">Java perspectives</a>
    <h3 class="related">Related Tasks</h3>
      <a href="../tasks/task-add_line_breakpoints.htm">Adding breakpoints</a><br>
      <a href="../tasks/task-launching_java_program.htm">Launching a Java program</a><br>
      <a href="../tasks/task-resuming_threads.htm">Resuming the execution of suspended threads</a><br>
      <a href="../tasks/task-running_and_debugging.htm">Running and debugging</a><br>
      <a href="../tasks/tasks-executionArgs.htm">Setting execution arguments</a><br>
      <a href="../tasks/task-suspending_threads.htm">Suspending threads</a>
    <h3 class="related">Related References</h3>
      <a href="../reference/views/debug/ref-debug_view.htm">Debug view</a>
  </body>
</html>

